<div class="order_search_form"></div>

<table class="easyui-treegrid order_search_result" title="" style="width:100%,height:250px"
       data-options="singleSelect:true,collapsible:true,idField: '_id',treeField: '_name'">
    <thead>
    <tr>
        <th data-options="field:'_name',width:150">订单</th>
        <th data-options="field:'_total',width:50,align:'right'">金额</th>
        <th data-options="field:'_amount',width:30,align:'right'">数量</th>
        <th data-options="field:'_statusText',width:80,align:'right'">状态</th>
        <th data-options="field:'_shippingAddress',width:250">收货地址</th>
        <th data-options="field:'_receiver',width:60,align:'center'">客户姓名</th>
        <th data-options="field:'_createTime',width:200">下单时间</th>
    </tr>
    </thead>
</table>


<script type="text/javascript">
    $('.order_search_form').bigwin('loadView','forms/order_search_form');

    $('.order_search_result').treegrid({toolbar: [{
        text:'修改',
        iconCls: 'icon-edit',
        handler: function(){
            var selected=$('.order_search_result').treegrid('getSelected')._id;
            $('.content .right').bigwin('loadView','forms/order_status_form',function(){
                console.log(selected);
                if(selected){
                    $('form.order_status_form').form({url:'/api/partners/'+qs['pa']+'/orders/'+selected+'/status'});
                    $.sget('/api/partners/'+qs['pa']+'/orders/'+selected,{},function(data){
                        data=flatObject(data);
                        $('form.order_status_form').form('load',data);
                    });
                }
            });
        }
    },'-']});

</script>